﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using CanDoo.Core.Data;
using CanDoo.Data;
using CanDoo.Admin.Core.Models;

namespace CanDoo.Oil.Core.Models
{
    /// <summary>
    /// 实体类——客户
    /// </summary>
    [Serializable]
    [Description("客户")]
    public class Customer :  EntityBase,ICreatedTime, IAudited,IRecyclable
    {
        [Display(Name = "物理卡号")]
        [StringLength(50)]
        public string PhysicalNo { get; set; }

        /// <summary>
        ///卡号
        /// </summary>
        [Display(Name = "卡号")]
        [Required, StringLength(50)]
        public string CardNo { get; set; }

        /// <summary>
        ///登录密码
        /// </summary>
        [Display(Name = "登录密码")]
        [Required, StringLength(50)]
        public string Password { get; set; }

        /// <summary>
        ///姓名
        /// </summary>
        [Display(Name = "姓名")]
        [Required, StringLength(50)]
        public override string Name { get; set; }

        /// <summary>
        ///性别
        /// </summary>
        [Display(Name = "性别")]
        [Required]
        public int Sex { get; set; }

        /// <summary>
        ///手机号
        /// </summary>
        [Display(Name = "手机号")]
        [StringLength(50)]
        public string MobilePhone { get; set; }

        /// <summary>
        ///身份证号
        /// </summary>
        [Display(Name = "身份证号")]
        [StringLength(50)]
        public string IDCard { get; set; }

        /// <summary>
        ///客户照片
        /// </summary>
        [Display(Name = "客户照片")]
        [StringLength(200)]
        public string ImageUrl { get; set; }

        /// <summary>
        ///开户行
        /// </summary>
        [Display(Name = "开户行")]
        [StringLength(50)]
        public string CardBank { get; set; }

        /// <summary>
        ///户名
        /// </summary>
        [Display(Name = "户名")]
        [StringLength(50)]
        public string CardName { get; set; }

        /// <summary>
        ///省
        /// </summary>
        [Display(Name = "省")]
        [StringLength(50)]
        public string Province { get; set; }

        /// <summary>
        ///市
        /// </summary>
        [Display(Name = "市")]
        [StringLength(50)]
        public string City { get; set; }

        /// <summary>
        ///区
        /// </summary>
        [Display(Name = "区")]
        [StringLength(50)]
        public string Area { get; set; }

        /// <summary>
        ///街道
        /// </summary>
        [Display(Name = "街道")]
        [StringLength(50)]
        public string Street { get; set; }

        /// <summary>
        ///详细地址
        /// </summary>
        [Display(Name = "详细地址")]
        [StringLength(200)]
        public string Address { get; set; }

        ///// <summary>
        /////客户类别--备用了  识别通过卡类别来搞1普通2服务中心3门店
        ///// </summary>
        //[Display(Name = "客户类别")]
        //[Required]
        //public int CustomerType { get; set; }

        /// <summary>
        ///客户等级
        /// </summary>
        [Display(Name = "客户等级")]
        public virtual CustomerLevel CustomerLevel { get; set; }
        /// <summary>
        ///客户等级外键
        /// </summary>
        [Display(Name = "客户等级外键")]
        public long CustomerLevelId { get; set; }

        /// <summary>
        ///卡类别1储值2储油3售油机管理卡4服务中心
        /// </summary>
        [Display(Name = "卡类别")]
        [Required]
        public int CardType { get; set; }

        /// <summary>
        ///购买限制
        /// </summary>
        [Display(Name = "购买限制")]
        public virtual Product LimitProduct { get; set; }
        /// <summary>
        ///购买限制外键
        /// </summary>
        [Display(Name = "购买限制外键")]
        public long? LimitProductId { get; set; }

        /// <summary>
        ///账户余额
        /// </summary>
        [Display(Name = "账户余额")]
        [Required]
        public double Balance { get; set; }

        /// <summary>
        ///总充值金额
        /// </summary>
        [Display(Name = "总充值金额")]
        [Required]
        public double TotalAmount { get; set; }

        /// <summary>
        ///在线支付金额
        /// </summary>
        [Display(Name = "在线支付金额")]
        [Required]
        public double OnLinePayMoney { get; set; }

        /// <summary>
        ///总消费金额
        /// </summary>
        [Display(Name = "总消费金额")]
        [Required]
        public double CostedMoney { get; set; }

        /// <summary>
        ///返现金额
        /// </summary>
        [Display(Name = "返现金额")]
        [Required]
        public double CashBackAmount { get; set; }

        /// <summary>
        ///积分
        /// </summary>
        [Display(Name = "积分")]
        [Required]
        public double Integral { get; set; }

        /// <summary>
        ///服务中心
        /// </summary>
        [Display(Name = "服务中心")]
        public virtual User ServiceCenter { get; set; }
        /// <summary>
        ///服务中心外键
        /// </summary>
        [Display(Name = "服务中心外键")]
        public long? ServiceCenterId { get; set; }

        /// <summary>
        ///上级客户(客户)
        /// </summary>
        [Display(Name = "上级客户(客户)")]
        public virtual User Parent { get; set; }
        /// <summary>
        ///上级客户(客户)外键
        /// </summary>
        [Display(Name = "上级客户(客户)外键")]
        public long? ParentId { get; set; }

        ///// <summary>
        /////是否服务中心 字段作废 通过卡类别来处理
        ///// </summary>
        //[Display(Name = "是否服务中心 字段作废 通过卡类别来处理")]
        //[Required]
        //public bool IsServiceCenter { get; set; }

        ///// <summary>
        /////服务中心激活人
        ///// </summary>
        //[Display(Name = "服务中心激活人")]
        //public virtual User ServiceCenterActiver { get; set; }
        ///// <summary>
        /////服务中心激活人外键
        ///// </summary>
        //[Display(Name = "服务中心激活人外键")]
        //public long? ServiceCenterActiverId { get; set; }

        ///// <summary>
        /////服务中心激活时间
        ///// </summary>
        //[Display(Name = "服务中心激活时间")]
        //public DateTime? SevriceCenterActiveTime { get; set; }

        /// <summary>
        ///是否在线
        /// </summary>
        [Display(Name = "是否在线")]
        [Required]
        public bool IsOnline { get; set; }

        /// <summary>
        ///是否锁定
        /// </summary>
        [Display(Name = "是否锁定")]
        public bool IsLocked { get; set; }

        /// <summary>
        /// 导致锁定的门店号
        /// </summary>
        [Display(Name = "导致锁定的门店号")]
        public string StoreNo { get; set; }

        /// <summary>
        ///状态更新时间
        /// </summary>
        [Display(Name = "状态更新时间")]
        public DateTime? StateUpdateTime { get; set; }

        /// <summary>
        /// 上次上报时间
        /// </summary>
        [Display(Name = "上次上报时间")]
        public DateTime? LastReportTime { get; set; }

        /// <summary>
        ///账号状态(激活)
        /// </summary>
        [Display(Name = "账号状态(激活)")]
        [Required]
        public bool Status { get; set; }

        /// <summary>
        ///激活人
        /// </summary>
        [Display(Name = "激活人")]
        public virtual User Activate { get; set; }
        /// <summary>
        ///激活人外键
        /// </summary>
        [Display(Name = "激活人外键")]
        public long? ActivateId { get; set; }

        /// <summary>
        ///激活时间
        /// </summary>
        [Display(Name = "激活时间")]
        public DateTime? ActivateTime { get; set; }

        /// <summary>
        ///门店简介
        /// </summary>
        [Display(Name = "门店简介")]
        [StringLength(500)]
        public string Introduction { get; set; }

        /// <summary>
        ///备注
        /// </summary>
        [Display(Name = "备注")]
        [StringLength(500)]
        public string Remark { get; set; }

        /// <summary>
        ///系统用户
        /// </summary>
        public virtual User User { get; set; }
        /// <summary>
        ///系统用户外键
        /// </summary>
        public long UserId { get; set; }


        /// <summary>
        ///面额
        /// </summary>
        [Display(Name = "面额")]
        public double Denomination { get; set; }

        /// <summary>
        ///是否制卡
        /// </summary>
        [Display(Name = "是否制卡")]
        public bool IsBurn { get; set; }


        public virtual ICollection<StoreActivity> StoreActivities { get; set; }

        #region Implementation of ICreatedTime

        /// <summary>
        /// 获取设置 信息创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        public DateTime CreatedTime { get; set; }
        #endregion

        #region Implementation of ICreatedAudited

        /// <summary>
        /// 获取或设置 创建者编号
        /// </summary>
        [Display(Name = "创建人")]
        public string CreatorUserId { get; set; }

        #endregion

        #region Implementation of IUpdateAutited

        /// <summary>
        /// 获取或设置 最后更新时间
        /// </summary>
        [Display(Name = "最后更新时间")]
        public DateTime? LastUpdatedTime { get; set; }

        /// <summary>
        /// 获取或设置 最后更新者编号
        /// </summary>
        [Display(Name = "最后更新用户")]
        public string LastUpdatorUserId { get; set; }

        #endregion

        #region Implementation of IsDeleted 逻辑删除接口
        /// <summary>
        /// 逻辑删除接口
        /// </summary>
        [Display(Name = "是否删除")]
        public bool IsDeleted { get; set; }
        #endregion
    }
}
